将同一产品下的部分设备进行分组后,方便用户对其统一管理,比如用户可以对某一组下的所有设备下发命令。
GET /api/v1/label
Query:
Name | Type | Description | Required |
---|---|---|---|
currentPage | int | 页码 | Yes |
pageSize | int | 每页条数(范围:1-50) | Yes |
product | int | 产品ID | Yes |
name | string | 名称(默认不传:全部),长度:0-128 | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/remove/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646¤tPage={currentPage}&pageSize={pageSize}&product={product}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 页码 |
pageSize | int | 每页条数(范围:1-50) |
content | struct[] | 当前页内容 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
created | long | 创建时间 |
description | string | 描述 |
deviceCount | long | 设备数量 |
onlineDeviceCount | long | 在线设备数量 |
enableDeviceCount | long | 启用设备数量 |
id | int | 分组ID |
name | string | 分组名称 |
productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": {
"content":[
{
"created": 0,
"description": "string",
"deviceCount": 0,
"enableDeviceCount": 0,
"id": 0,
"name": "string",
"onlineDeviceCount": 0,
"productId": 0
}
],
"currentPage": 1,
"pageSize": 1,
"totalCount": 4,
"totalPage": 4
}
}
POST /api/v1/label
Body:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
name | string | 分组名称 | Yes |
description | string | 描述 | No |
Body example:
{
"productId":100687,
"name":"string123",
"description":"string"
}
cURL example:
curl --location --request POST '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"description": "string",
"name": "string123",
"productId": 100687
}'
Response data:
Name | Type | Description |
---|---|---|
created | long | 创建时间 |
description | string | 描述 |
id | int | 分组ID |
name | string | 分组名称 |
productId | int | 产品ID |
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": {
"id": 174,
"productId": 100687,
"name": "string123",
"created": 1578474716405,
"description": "string"
}
}
PUT /api/v1/label
Body:
Name | Type | Description | Required |
---|---|---|---|
id | Type | 分组ID | Yes |
name | string | 分组名称 | No |
description | string | 描述 | No |
Body example:
{
"id":131,
"name":"string345",
"description":"string11"
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"id":131,
"name":"string345",
"description":"string11"
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
DELETE /api/v1/label
Body:
Name | Type | Description | Required |
---|---|---|---|
ids | int[] | 分组ID数组 | Yes |
Body example:
{
"ids": [128]
}
cURL example:
curl --location --request DELETE '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": [128]
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
GET /api/v1/label/id/{id}
Path:
Name | Type | Description | Required |
---|---|---|---|
id | int | 分组ID | Yes |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/id/{id}?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
created | long | 创建时间 |
description | string | 描述 |
deviceCount | long | 设备数量 |
onlineDeviceCount | long | 在线设备数量 |
enableDeviceCount | long | 启用设备数量 |
id | int | 分组ID |
name | string | 分组名称 |
productId | int | 产品ID |
Response example:
{
"data": {
"id": 207,
"productId": 102257,
"name": "my1112",
"created": 1581557875105,
"description": "",
"deviceCount": 0,
"onlineDeviceCount": 0,
"enableDeviceCount": 0
},
"success": true,
"code": 0,
"msg": null
}
PUT /api/v1/label/add/devices
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | int[] | 设备ID数组 | Yes |
labelId | int | 分组ID | Yes |
Body example:
{
"deviceIds": [
10237731
],
"labelId": 128
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/add/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [
10237731
],
"labelId": 128
}'
Response example:
{
"success": true,
"code": 0,
"msg": "",
"data": null
}
PUT /api/v1/label/remove/devices
Body:
Name | Type | Description | Required |
---|---|---|---|
deviceIds | int[] | 设备ID数组 | Yes |
labelId | int | 分组ID | Yes |
Body example:
{
"deviceIds": [
10237731
],
"labelId": 128
}
cURL example:
curl --location --request PUT '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/remove/devices?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646' \
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--header 'Content-Type: application/json' \
--data-raw '{
"deviceIds": [
10237731
],
"labelId": 128
}'
Response example:
{
"success": true,
"code": 0,
"msg": null,
"data": null
}
GET /api/v1/label/group/{relation}/page
Path:
Name | Type | Description | Required |
---|---|---|---|
relation | string | IN/NIN | Yes |
Query:
Name | Type | Description | Required |
---|---|---|---|
currentPage | int | 页码 | Yes |
pageSize | int | 每页条数 | Yes |
protocol | int | 产品协议,LWM2M时请传2 | No |
label | string | 分组ID | Yes |
name | string | 设备名称 | No |
cURL example:
curl --location --request GET '{URI-scheme}://{Endpoint}{path-prefix}/api/v1/label/group/{relation}/page?accessKeyId={accessKeyId}&signature={signature}&signatureNonce=646¤tPage={currentPage}&pageSize={pageSize}&label={label}' \
--header 'platform: 1' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
currentPage | int | 页码 |
pageSize | int | 每页条数(范围:1-50) |
content | struct[] | 当前页内容 |
totalCount | long | 总条数 |
totalPage | int | 总页数 |
Response data content的子对象结构体:
Name | Type | Description |
---|---|---|
created | long | 创建时间 |
description | string | 描述 |
adminState | int | 启用状态,0-禁用,1-启用,2-用户禁用 |
apiKey | string | 设备key |
connectGatewayId | string | 当前连接的网关 |
encrypt | boolean | 是否加密,0:不加密,1:加密 |
name | string | 设备名 |
labels | string[] | 产品标签 |
id | int | 设备ID |
lastConnected | long | 最近上线时间 |
lastReported | long | 最近上报状态的时间 |
location | string | 位置 |
modified | long | 修改时间 |
operatingState | string | 上下线状态(0-disabled,1-enabled,2-gatewayenabled,3-未激活) |
parentId | int | 关联网关ID |
userId | string | 用户ID |
protocolType | int | 协议类型,1:MQTT,2:LWM2M,3:TCP,4:Modbus,5:OPC UA |
productId | int | 产品ID |
Response example:
{
"data": {
"currentPage": 1,
"pageSize": 5,
"totalCount": 1,
"totalPage": 1,
"content": [
{
"id": 10161375,
"name": "tttt",
"userId": null,
"productId": 102257,
"created": 1581558519960,
"modified": 1581558519960,
"description": "",
"adminState": 1,
"operatingState": 0,
"labels": null,
"lastConnected": 0,
"lastReported": 0,
"location": null,
"apiKey": "MDFkMTRlNmFjMGY2MDlmMzk3MmM=",
"protocolType": 3,
"connectGatewayId": "0",
"encrypt": false,
"parentid": null
}
]
},
"success": true,
"code": 0,
"msg": null
}